home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK2.toast / Development Kits (Disc 2) / QuickTime / QuickTime™ 2.5 / Interfaces for Programmers / PInterfaces / ImageCodec.p < prev    next >
Encoding:
Text File  |  1997-02-26  |  13.6 KB  |  369 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        ImageCodec.p
  3.  
  4.      Contains:    QuickTime interfaces
  5.  
  6.      Version:    Technology:    
  7.                  Release:    QuickTime 2.5 interfaces to use with ETO #20
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT ImageCodec;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __IMAGECODEC__}
  28. {$SETC __IMAGECODEC__ := 1}
  29.  
  30. {$I+}
  31. {$SETC ImageCodecIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __QUICKDRAW__}
  38. {$I Quickdraw.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __QDOFFSCREEN__}
  41. {$I QDOffscreen.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __WINDOWS__}
  44. {$I Windows.p}
  45. {$ENDC}
  46. {$IFC UNDEFINED __IMAGECOMPRESSION__}
  47. {$I ImageCompression.p}
  48. {$ENDC}
  49. {$IFC UNDEFINED __COMPONENTS__}
  50. {$I Components.p}
  51. {$ENDC}
  52. {$IFC UNDEFINED __MOVIES__}
  53. {$I Movies.p}
  54. {$ENDC}
  55.  
  56. {$PUSH}
  57. {$ALIGN MAC68K}
  58. {$LibExport+}
  59.  
  60. {     codec capabilities flags     }
  61.  
  62. CONST
  63.     codecCanScale                = $00000001;
  64.     codecCanMask                = $00000002;
  65.     codecCanMatte                = $00000004;
  66.     codecCanTransform            = $00000008;
  67.     codecCanTransferMode        = $00000010;
  68.     codecCanCopyPrev            = $00000020;
  69.     codecCanSpool                = $00000040;
  70.     codecCanClipVertical        = $00000080;
  71.     codecCanClipRectangular        = $00000100;
  72.     codecCanRemapColor            = $00000200;
  73.     codecCanFastDither            = $00000400;
  74.     codecCanSrcExtract            = $00000800;
  75.     codecCanCopyPrevComp        = $00001000;
  76.     codecCanAsync                = $00002000;
  77.     codecCanMakeMask            = $00004000;
  78.     codecCanShift                = $00008000;
  79.     codecCanAsyncWhen            = $00010000;
  80.     codecCanShieldCursor        = $00020000;
  81.     codecCanManagePrevBuffer    = $00040000;
  82.     codecHasVolatileBuffer        = $00080000;
  83.     codecWantsRegionMask        = $00100000;
  84.     codecImageBufferIsOnScreen    = $00200000;
  85.     codecWantsDestinationPixels    = $00400000;
  86.  
  87.  
  88. TYPE
  89.     CodecCapabilitiesPtr = ^CodecCapabilities;
  90.     CodecCapabilities = RECORD
  91.         flags:                    LONGINT;
  92.         wantedPixelSize:        INTEGER;
  93.         extendWidth:            INTEGER;
  94.         extendHeight:            INTEGER;
  95.         bandMin:                INTEGER;
  96.         bandInc:                INTEGER;
  97.         pad:                    INTEGER;
  98.         time:                    LONGINT;
  99.     END;
  100.  
  101. {     codec condition flags     }
  102.  
  103. CONST
  104.     codecConditionFirstBand        = $00000001;
  105.     codecConditionLastBand        = $00000002;
  106.     codecConditionFirstFrame    = $00000004;
  107.     codecConditionNewDepth        = $00000008;
  108.     codecConditionNewTransform    = $00000010;
  109.     codecConditionNewSrcRect    = $00000020;
  110.     codecConditionNewMask        = $00000040;
  111.     codecConditionNewMatte        = $00000080;
  112.     codecConditionNewTransferMode = $00000100;
  113.     codecConditionNewClut        = $00000200;
  114.     codecConditionNewAccuracy    = $00000400;
  115.     codecConditionNewDestination = $00000800;
  116.     codecConditionFirstScreen    = $00001000;
  117.     codecConditionDoCursor        = $00002000;
  118.     codecConditionCatchUpDiff    = $00004000;
  119.     codecConditionMaskMayBeChanged = $00008000;
  120.     codecConditionToBuffer        = $00010000;
  121.     codecConditionCodecChangedMask = $80000000;
  122.  
  123.     codecInfoResourceType        = 'cdci';                        {  codec info resource type  }
  124.     codecInterfaceVersion        = 2;                            {  high word returned in component GetVersion  }
  125.  
  126.  
  127. TYPE
  128.     CDSequenceDataSourcePtr = ^CDSequenceDataSource;
  129.     CDSequenceDataSource = RECORD
  130.         recordSize:                LONGINT;
  131.         next:                    Ptr;
  132.         seqID:                    ImageSequence;
  133.         sourceID:                ImageSequenceDataSource;
  134.         sourceType:                OSType;
  135.         sourceInputNumber:        LONGINT;
  136.         dataPtr:                Ptr;
  137.         dataDescription:        Handle;
  138.         changeSeed:                LONGINT;
  139.         transferProc:            ICMConvertDataFormatUPP;
  140.         transferRefcon:            Ptr;
  141.         dataSize:                LONGINT;
  142.     END;
  143.  
  144.     CodecCompressParamsPtr = ^CodecCompressParams;
  145.     CodecCompressParams = RECORD
  146.         sequenceID:                ImageSequence;                            {  precompress,bandcompress  }
  147.         imageDescription:        ImageDescriptionHandle;                    {  precompress,bandcompress  }
  148.         data:                    Ptr;
  149.         bufferSize:                LONGINT;
  150.         frameNumber:            LONGINT;
  151.         startLine:                LONGINT;
  152.         stopLine:                LONGINT;
  153.         conditionFlags:            LONGINT;
  154.         callerFlags:            CodecFlags;
  155.         capabilities:            CodecCapabilitiesPtr;                    {  precompress,bandcompress  }
  156.         progressProcRecord:        ICMProgressProcRecord;
  157.         completionProcRecord:    ICMCompletionProcRecord;
  158.         flushProcRecord:        ICMFlushProcRecord;
  159.         srcPixMap:                PixMap;                                    {  precompress,bandcompress  }
  160.         prevPixMap:                PixMap;
  161.         spatialQuality:            CodecQ;
  162.         temporalQuality:        CodecQ;
  163.         similarity:                Fixed;
  164.         dataRateParams:            DataRateParamsPtr;
  165.         reserved:                LONGINT;
  166.                                                                         {  The following fields only exist for QuickTime 2.1 and greater  }
  167.         majorSourceChangeSeed:    UInt16;
  168.         minorSourceChangeSeed:    UInt16;
  169.         sourceData:                CDSequenceDataSourcePtr;
  170.                                                                         {  The following fields only exit for QuickTime 2.5 and greater  }
  171.         preferredPacketSizeInBytes: LONGINT;
  172.     END;
  173.  
  174.     CodecDecompressParamsPtr = ^CodecDecompressParams;
  175.     CodecDecompressParams = RECORD
  176.         sequenceID:                ImageSequence;                            {  predecompress,banddecompress  }
  177.         imageDescription:        ImageDescriptionHandle;                    {  predecompress,banddecompress  }
  178.         data:                    Ptr;
  179.         bufferSize:                LONGINT;
  180.         frameNumber:            LONGINT;
  181.         startLine:                LONGINT;
  182.         stopLine:                LONGINT;
  183.         conditionFlags:            LONGINT;
  184.         callerFlags:            CodecFlags;
  185.         capabilities:            CodecCapabilitiesPtr;                    {  predecompress,banddecompress  }
  186.         progressProcRecord:        ICMProgressProcRecord;
  187.         completionProcRecord:    ICMCompletionProcRecord;
  188.         dataProcRecord:            ICMDataProcRecord;
  189.         port:                    CGrafPtr;                                {  predecompress,banddecompress  }
  190.         dstPixMap:                PixMap;                                    {  predecompress,banddecompress  }
  191.         maskBits:                BitMapPtr;
  192.         mattePixMap:            PixMapPtr;
  193.         srcRect:                Rect;                                    {  predecompress,banddecompress  }
  194.         matrix:                    MatrixRecordPtr;                        {  predecompress,banddecompress  }
  195.         accuracy:                CodecQ;                                    {  predecompress,banddecompress  }
  196.         transferMode:            INTEGER;                                {  predecompress,banddecompress  }
  197.         frameTime:                ICMFrameTimePtr;                        {  banddecompress  }
  198.         reserved:                ARRAY [0..0] OF LONGINT;
  199.                                                                         {  The following fields only exist for QuickTime 2.0 and greater  }
  200.         matrixFlags:            SInt8;                                    {  high bit set if 2x resize  }
  201.         matrixType:                SInt8;
  202.         dstRect:                Rect;                                    {  only valid for simple transforms  }
  203.                                                                         {  The following fields only exist for QuickTime 2.1 and greater  }
  204.         majorSourceChangeSeed:    UInt16;
  205.         minorSourceChangeSeed:    UInt16;
  206.         sourceData:                CDSequenceDataSourcePtr;
  207.         maskRegion:                RgnHandle;
  208.                                                                         {  The following fields only exist for QuickTime 2.5 and greater  }
  209.         wantedDestinationPixelTypes: ^OSTypePtr;                        {  Handle to 0-terminated list of OSTypes  }
  210.         screenFloodMethod:        LONGINT;
  211.         screenFloodValue:        LONGINT;
  212.         preferredOffscreenPixelSize: INTEGER;
  213.     END;
  214.  
  215.  
  216. CONST
  217.     matrixFlagScale2x            = $00000080;
  218.     matrixFlagScale1x            = $00000040;
  219.     matrixFlagScaleHalf            = $00000020;
  220.  
  221.     kScreenFloodMethodNone        = 0;
  222.     kScreenFloodMethodKeyColor    = 1;
  223.     kScreenFloodMethodAlpha        = 2;
  224.  
  225. {     codec selectors 0-127 are reserved by Apple  }
  226. {     codec selectors 128-191 are subtype specific  }
  227. {     codec selectors 192-255 are vendor specific  }
  228. {     codec selectors 256-32767 are available for general use  }
  229. {     negative selectors are reserved by the Component Manager  }
  230. FUNCTION ImageCodecGetCodecInfo(ci: ComponentInstance; VAR info: CodecInfo): ComponentResult;
  231.     {$IFC NOT GENERATINGCFM}
  232.     INLINE $2F3C, $0004, $0000, $7000, $A82A;
  233.     {$ENDC}
  234. FUNCTION ImageCodecGetCompressionTime(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; depth: INTEGER; VAR spatialQuality: CodecQ; VAR temporalQuality: CodecQ; VAR time: LONGINT): ComponentResult;
  235.     {$IFC NOT GENERATINGCFM}
  236.     INLINE $2F3C, $0016, $0001, $7000, $A82A;
  237.     {$ENDC}
  238. FUNCTION ImageCodecGetMaxCompressionSize(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; depth: INTEGER; quality: CodecQ; VAR size: LONGINT): ComponentResult;
  239.     {$IFC NOT GENERATINGCFM}
  240.     INLINE $2F3C, $0012, $0002, $7000, $A82A;
  241.     {$ENDC}
  242. FUNCTION ImageCodecPreCompress(ci: ComponentInstance; VAR params: CodecCompressParams): ComponentResult;
  243.     {$IFC NOT GENERATINGCFM}
  244.     INLINE $2F3C, $0004, $0003, $7000, $A82A;
  245.     {$ENDC}
  246. FUNCTION ImageCodecBandCompress(ci: ComponentInstance; VAR params: CodecCompressParams): ComponentResult;
  247.     {$IFC NOT GENERATINGCFM}
  248.     INLINE $2F3C, $0004, $0004, $7000, $A82A;
  249.     {$ENDC}
  250. FUNCTION ImageCodecPreDecompress(ci: ComponentInstance; VAR params: CodecDecompressParams): ComponentResult;
  251.     {$IFC NOT GENERATINGCFM}
  252.     INLINE $2F3C, $0004, $0005, $7000, $A82A;
  253.     {$ENDC}
  254. FUNCTION ImageCodecBandDecompress(ci: ComponentInstance; VAR params: CodecDecompressParams): ComponentResult;
  255.     {$IFC NOT GENERATINGCFM}
  256.     INLINE $2F3C, $0004, $0006, $7000, $A82A;
  257.     {$ENDC}
  258. FUNCTION ImageCodecBusy(ci: ComponentInstance; seq: ImageSequence): ComponentResult;
  259.     {$IFC NOT GENERATINGCFM}
  260.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  261.     {$ENDC}
  262. FUNCTION ImageCodecGetCompressedImageSize(ci: ComponentInstance; desc: ImageDescriptionHandle; data: Ptr; bufferSize: LONGINT; dataProc: ICMDataProcRecordPtr; VAR dataSize: LONGINT): ComponentResult;
  263.     {$IFC NOT GENERATINGCFM}
  264.     INLINE $2F3C, $0014, $0008, $7000, $A82A;
  265.     {$ENDC}
  266. FUNCTION ImageCodecGetSimilarity(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; desc: ImageDescriptionHandle; data: Ptr; VAR similarity: Fixed): ComponentResult;
  267.     {$IFC NOT GENERATINGCFM}
  268.     INLINE $2F3C, $0014, $0009, $7000, $A82A;
  269.     {$ENDC}
  270. FUNCTION ImageCodecTrimImage(ci: ComponentInstance; Desc: ImageDescriptionHandle; inData: Ptr; inBufferSize: LONGINT; dataProc: ICMDataProcRecordPtr; outData: Ptr; outBufferSize: LONGINT; flushProc: ICMFlushProcRecordPtr; VAR trimRect: Rect; progressProc: ICMProgressProcRecordPtr): ComponentResult;
  271.     {$IFC NOT GENERATINGCFM}
  272.     INLINE $2F3C, $0024, $000A, $7000, $A82A;
  273.     {$ENDC}
  274. FUNCTION ImageCodecRequestSettings(ci: ComponentInstance; settings: Handle; VAR rp: Rect; filterProc: ModalFilterUPP): ComponentResult;
  275.     {$IFC NOT GENERATINGCFM}
  276.     INLINE $2F3C, $000C, $000B, $7000, $A82A;
  277.     {$ENDC}
  278. FUNCTION ImageCodecGetSettings(ci: ComponentInstance; settings: Handle): ComponentResult;
  279.     {$IFC NOT GENERATINGCFM}
  280.     INLINE $2F3C, $0004, $000C, $7000, $A82A;
  281.     {$ENDC}
  282. FUNCTION ImageCodecSetSettings(ci: ComponentInstance; settings: Handle): ComponentResult;
  283.     {$IFC NOT GENERATINGCFM}
  284.     INLINE $2F3C, $0004, $000D, $7000, $A82A;
  285.     {$ENDC}
  286. FUNCTION ImageCodecFlush(ci: ComponentInstance): ComponentResult;
  287.     {$IFC NOT GENERATINGCFM}
  288.     INLINE $2F3C, $0000, $000E, $7000, $A82A;
  289.     {$ENDC}
  290. FUNCTION ImageCodecSetTimeCode(ci: ComponentInstance; timeCodeFormat: UNIV Ptr; timeCodeTime: UNIV Ptr): ComponentResult;
  291.     {$IFC NOT GENERATINGCFM}
  292.     INLINE $2F3C, $0008, $000F, $7000, $A82A;
  293.     {$ENDC}
  294. FUNCTION ImageCodecIsImageDescriptionEquivalent(ci: ComponentInstance; newDesc: ImageDescriptionHandle; VAR equivalent: BOOLEAN): ComponentResult;
  295.     {$IFC NOT GENERATINGCFM}
  296.     INLINE $2F3C, $0008, $0010, $7000, $A82A;
  297.     {$ENDC}
  298. FUNCTION ImageCodecNewMemory(ci: ComponentInstance; VAR data: Ptr; dataSize: Size; dataUse: LONGINT; memoryGoneProc: ICMMemoryDisposedUPP; refCon: UNIV Ptr): ComponentResult;
  299.     {$IFC NOT GENERATINGCFM}
  300.     INLINE $2F3C, $0014, $0011, $7000, $A82A;
  301.     {$ENDC}
  302. FUNCTION ImageCodecDisposeMemory(ci: ComponentInstance; data: Ptr): ComponentResult;
  303.     {$IFC NOT GENERATINGCFM}
  304.     INLINE $2F3C, $0004, $0012, $7000, $A82A;
  305.     {$ENDC}
  306. FUNCTION ImageCodecHitTestData(ci: ComponentInstance; desc: ImageDescriptionHandle; data: UNIV Ptr; dataSize: Size; where: Point; VAR hit: BOOLEAN): ComponentResult;
  307.     {$IFC NOT GENERATINGCFM}
  308.     INLINE $2F3C, $0014, $0013, $7000, $A82A;
  309.     {$ENDC}
  310. FUNCTION ImageCodecNewImageBufferMemory(ci: ComponentInstance; VAR params: CodecDecompressParams; flags: LONGINT; memoryGoneProc: ICMMemoryDisposedUPP; refCon: UNIV Ptr): ComponentResult;
  311.     {$IFC NOT GENERATINGCFM}
  312.     INLINE $2F3C, $0010, $0014, $7000, $A82A;
  313.     {$ENDC}
  314. FUNCTION ImageCodecExtractAndCombineFields(ci: ComponentInstance; fieldFlags: LONGINT; data1: UNIV Ptr; dataSize1: LONGINT; desc1: ImageDescriptionHandle; data2: UNIV Ptr; dataSize2: LONGINT; desc2: ImageDescriptionHandle; outputData: UNIV Ptr; VAR outDataSize: LONGINT; descOut: ImageDescriptionHandle): ComponentResult;
  315.     {$IFC NOT GENERATINGCFM}
  316.     INLINE $2F3C, $0028, $0015, $7000, $A82A;
  317.     {$ENDC}
  318. FUNCTION ImageCodecGetMaxCompressionSizeWithSources(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; depth: INTEGER; quality: CodecQ; sourceData: CDSequenceDataSourcePtr; VAR size: LONGINT): ComponentResult;
  319.     {$IFC NOT GENERATINGCFM}
  320.     INLINE $2F3C, $0016, $0016, $7000, $A82A;
  321.     {$ENDC}
  322.  
  323. CONST
  324.     kMotionJPEGTag                = 'mjpg';
  325.  
  326.  
  327. TYPE
  328.     MotionJPEGApp1MarkerPtr = ^MotionJPEGApp1Marker;
  329.     MotionJPEGApp1Marker = RECORD
  330.         unused:                    LONGINT;
  331.         tag:                    LONGINT;
  332.         fieldSize:                LONGINT;
  333.         paddedFieldSize:        LONGINT;
  334.         offsetToNextField:        LONGINT;
  335.         qTableOffset:            LONGINT;
  336.         huffmanTableOffset:        LONGINT;
  337.         sofOffset:                LONGINT;
  338.         sosOffset:                LONGINT;
  339.         soiOffset:                LONGINT;
  340.     END;
  341.  
  342. FUNCTION QTPhotoSetSampling(codec: ComponentInstance; yH: INTEGER; yV: INTEGER; cbH: INTEGER; cbV: INTEGER; crH: INTEGER; crV: INTEGER): ComponentResult;
  343.     {$IFC NOT GENERATINGCFM}
  344.     INLINE $2F3C, $000C, $0100, $7000, $A82A;
  345.     {$ENDC}
  346. FUNCTION QTPhotoSetRestartInterval(codec: ComponentInstance; restartInterval: INTEGER): ComponentResult;
  347.     {$IFC NOT GENERATINGCFM}
  348.     INLINE $2F3C, $0002, $0101, $7000, $A82A;
  349.     {$ENDC}
  350. FUNCTION QTPhotoDefineHuffmanTable(codec: ComponentInstance; componentNumber: INTEGER; isDC: BOOLEAN; VAR lengthCounts: UInt8; VAR values: UInt8): ComponentResult;
  351.     {$IFC NOT GENERATINGCFM}
  352.     INLINE $2F3C, $000C, $0102, $7000, $A82A;
  353.     {$ENDC}
  354. FUNCTION QTPhotoDefineQuantizationTable(codec: ComponentInstance; componentNumber: INTEGER; VAR table: UInt8): ComponentResult;
  355.     {$IFC NOT GENERATINGCFM}
  356.     INLINE $2F3C, $0006, $0103, $7000, $A82A;
  357.     {$ENDC}
  358. {  UPP call backs  }
  359. {$ALIGN RESET}
  360. {$POP}
  361.  
  362. {$SETC UsingIncludes := ImageCodecIncludes}
  363.  
  364. {$ENDC} {__IMAGECODEC__}
  365.  
  366. {$IFC NOT UsingIncludes}
  367.  END.
  368. {$ENDC}
  369.